﻿using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;

namespace Library.Collections
{
    public interface ITreeReadOnly
    {
        [Pure]
        IEnumerable Children { get; }
    }

    public interface ITree : ITreeReadOnly
    {
        [Pure]
        new IList Children { get; }
    }
}

namespace Library.Collections.Generic
{
    public interface ITreeReadOnly<out TNode>
        where TNode : ITreeReadOnly<TNode>
    {
        [Pure]
        IEnumerable<TNode> Children { get; }
    }

    public interface ITree<TNode> : ITreeReadOnly<TNode>
        where TNode : ITreeReadOnly<TNode>
    {
        [Pure]
        new IList<TNode> Children { get; }
    }
}
